#include <gtest/gtest.h>
#include <gmock/gmock.h>

#include "safety/io/safeio.h"

// TEST(SafeioTest, dualcheck)
// {
//     EXPECT_EQ(safety::InputItf::dual_check(0, 0, 0), safety::SafeStat::UnSafe);
//     EXPECT_EQ(safety::InputItf::dual_check(0, 0, 1), safety::SafeStat::UnSafe);
//     EXPECT_EQ(safety::InputItf::dual_check(0, 1, 0), safety::SafeStat::UnSafe);
//     EXPECT_EQ(safety::InputItf::dual_check(0, 1, 1), safety::SafeStat::Fault);
//     EXPECT_EQ(safety::InputItf::dual_check(1, 0, 0), safety::SafeStat::UnSafe);
//     EXPECT_EQ(safety::InputItf::dual_check(1, 0, 1), safety::SafeStat::Fault);
//     EXPECT_EQ(safety::InputItf::dual_check(1, 0, 0), safety::SafeStat::UnSafe);
//     EXPECT_EQ(safety::InputItf::dual_check(1, 1, 0), safety::SafeStat::Safe);
//     EXPECT_EQ(safety::InputItf::dual_check(1, 1, 1), safety::SafeStat::Safe);
// }

TEST(SafeioTest, load_cfg)
{
    auto& sio = safety::SafeIOMgr::instance();
    SafeIO_ConfigParam cfg;
    ASSERT_NO_THROW(cfg = sio.load_config("configs/JAKA/usersettings.ini"));
    EXPECT_EQ(cfg.usr_safein_ev[0], SafeIO_UsrSafeInputEv::EXT_ESTOP);
    EXPECT_EQ(cfg.usr_safeout_ev[1], SafeIO_UsrSafeOutputEv::SYS_ESTOP);
}